package card;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: adol book
 * Date: 2022-04-28
 * Time: 7:55
 */


public class cardMothor {
    public static final String[] sutes = {"♠","♥","♣","♦"};
    public static List<Card> buycard(){ //得到一副牌
        List<Card> dest = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            for (int j = 1; j <= 13 ; j++) {
                Card card = new Card(sutes[i], j);
                dest.add(card);
            }
        }
        return dest;
    }
    public static void fun(List<Card> cards){ //揭牌，从0下标揭起
        for (int k = cards.size()-1; k > 0; k-- ){
            Random random = new Random(); //相当于删除,
            int index = random.nextInt(k);
            swep(cards,k,index);
        }
    }
    public static void swep(List<Card> cards,int i,int j){//换牌
        Card tem = cards.get(i);
        cards.set(i,cards.get(j));
        cards.set(j,tem);
    }
}
